<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>菜鸟教程(runoob.com)</title>
<script>
function checkField(val)
{
	alert("输入值已改变。新值为: " + val);
}
</script>
</head>
<body>

<p>修改输入域的文本，点击输入域外区域触发 onchange。</p>
输入文本: <input type="text" name="txt" value="Hello" onchange="checkField(this.value)">

</body>
</html>